-
Notifications
You must be signed in to change notification settings - Fork 46.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make form events bubble again #19285
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 04320fd:
|
Alternatively, we could change the Jest test for testing |
I don't feel like I have enough context to approve or reject this PR. Seems like the answer hinges on this question:
So then my question is: Who should make that decision? (That's the thing I really don't have context on- how much effort would it be to fix Workplace.) |
I'm looking into this now with @philipp-spiess. If we can't make this change though, the only other thing would be to not do this PR right now, and keep |
I've put up an alternative approach: #19300 |
😄 |
This PR changes form events, specifically
submit
andreset
so that behave as native bubbling events. Today, with the modern event system, that means making them not use the capture phase.There are a few issues though. We want to move towards removing the notion of have a special capture phase for certain events. One effort is to make them listen only to their target element, as we do in this PR: #19278. That works for all tests, apart from the recent regression test that @gaearon added, where we expect
submit
to be event replayed. We can't replay events that are only attached to their target, as that means we'll double-fire if we try to listen to them on the root too.Moving
submit
andreset
to bubble phase sound sensible then right? They natively bubble anyway according to DOM spec, and this includes all major browsers we support. The issue is that we have a Jest test and a reference PR that shows where this went wrong in the past:#13462
Can we maybe go back and fix this problem internally? Then it would unblock this particular set of events and make them behave as they should do. It would also mean that we don't need to treat it as a target only event in #19278, and thus the test that @gaearon added should pass.